home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / programming / blitz / makefile / docs / includes.doc next >
Encoding:
Text File  |  1996-04-24  |  5.8 KB  |  147 lines

  1. This is a set of includefiles, that have prooven their worth with me
  2. over the  years.   They  are  all  very  simple, and you are probably better
  3. off editing  them  yourself,  to your needs and desired.
  4. Basicly, its just a set  of  routines  that are boring to write from time
  5. to time.  I hope you like  them,  and  that  you  add  a  lot  of  nice stuff
  6. to your includes.
  7. ;-----------------------------------------------------
  8.   IncName:  string/spacesort.bb  |String$
  9.   Type   :  Function.S
  10.  
  11.   If you use str$() to turn a value into an string, you always get an extra
  12.   character (space), simply pass it onto the spacesort{} function, and it
  13.   returns your string value totaly clean.
  14.   Also great for testing commands passed to your program.
  15.   Ex:   a$=spacesort{par$(1)+par$(2)}
  16.         if a$="testingon" then goto do_on... etc,,,
  17.   Make use of it!
  18.  -----------------------------------------------------
  19.   IncName: string/remove.bb      |String$/String$
  20.   Type   : Function.S
  21.  
  22.   This is a really great function, if you have a string, and want to remove a
  23.   word, or a character, then simply pass on your string, and the word to remove
  24.   and it will return your processed string!
  25.   Ex: a$="How are you?"
  26.       a$=remove{a$,"you?"}
  27.       (A$ is now -> "How are ")
  28.  -----------------------------------------------------
  29.   IncName: string/pokestring.bb |Adresse.l/String$
  30.   Type   : statement
  31.  
  32.  A very nice little routine, and easy to convert to Assembly!. Takes a string
  33.  and put it into memory. Great when dealing with large stringbased structures.
  34.  
  35.   Ex: pokestring{adr.l,"Hello"+chr$(0)}
  36.  -----------------------------------------------------
  37.   IncName: String/Tabsort.bb   |String$
  38.   type   : statement
  39.  
  40.   If you (like us all) at some time make a routine for loading in textfiles,
  41.   be it a preferences file or a document, then this is a nice little
  42.   routine. It scans through a string and looks for any tabulator marks.
  43.   If it finds any, they will be erased!
  44.   Thus, you can profile your own textlook.
  45.   Easy to extend!
  46.   Ex: a$=tabsort{text_file_string$}
  47.  
  48.  -----------------------------------------------------
  49.   IncName: getfontWidth.bb   |string$/size.w
  50.   Type   : function.w
  51.  
  52.   Well, im not realy done with this one, but if you take close look at
  53.   the .font files, you will find a word containg the calculation width
  54.   of the fontbase. This width tells you the width of a character in
  55.   LOW-CASE!!, That means you will have to scan through your textline
  56.   looking for Upper-case characters, as they are larger!.
  57.   I have found that adding (Width/2) usualy works with UpperCase characters.
  58.   Note! This function will load the font into memory to read off the width,
  59.   the memory is then freed!, its silly i know, but its just a betha-cetha
  60.   version.
  61.   Ex: fontwidth.w=getfontwidth{"times",16}
  62.  
  63.  -----------------------------------------------------
  64.   IncName: BmapHandler.bb |Variable
  65.   Type   : Statement
  66.  
  67.   Ever wanted to close all your screens or bitmaps at once?, This is
  68.   exactly what this routine does. It also makes two constants -
  69.   <Bitmaps> & <Screens>
  70.   Its very simple to use!
  71.   Ex:  closeall{#bitmaps}    <-- this will free all bitmaps
  72.        closeall{#screens}    <-- this will free all intui screens!
  73.  
  74.  -----------------------------------------------------
  75.   IncName: Finish_mouse.bb
  76.   Type   : Statement
  77.  
  78.   Well, this might seem like a silly thing, but it waits until the
  79.   user has let go of the left/right mousebutton. Even a complete
  80.   amos user could write this!, but its handy! and booring to write.
  81.   EX:  finish_mouse{}
  82.  -----------------------------------------------------
  83.   IncName: BOLT/Getlinks.bb  |Variable.
  84.   Type   : function.L
  85.  
  86.   When you use my makefile utillity, you need some easy way to handle them.
  87.   Simply allocate some memory, and bload the bolt file in.
  88.   To find out how many files are stored in the Bolt file, use this
  89.   function.
  90.  
  91.   Ex: adr.l=allocmem{filesize,2}
  92.       bload "filename",adr.l
  93.       linked_files.l=getlinks{adr.l}
  94.       ...
  95.  -----------------------------------------------------
  96.   IncName: BOLT/getlink_name.bb |variable/Variable
  97.   Type   : function.S
  98.  
  99.   EX:   adr.l=allocmem{filesize,2}
  100.         bload "filename",adr.l
  101.     name$=getlink_name{1,adr}
  102.  
  103.   Since each Bolt file stores the original filenames within its
  104.   structure, use this function to extract a filename. Use "getlinks{}"
  105.   to find out how many filenames are there.
  106.   This will return "*" if you passed a non-registrated pointer.
  107.  -----------------------------------------------------
  108.   IncName: Bolt/Getlink_size.bb |variable/Variable
  109.   Type   : Function.L
  110.  
  111.   To get the bytesize of one of the linked files, use this.
  112.   Again remember to use "Getlinks{}" to find out how many files
  113.   are in the BOLT. If you pass either 0 or >links, then -1 will be
  114.   returned.
  115.  
  116.   Ex:  adr.l=allocmem{filesize,2}
  117.        bload "filename",adr.l
  118.        files_linked.l=getlinks{}
  119.        filesize.l=getlink_size{1,adr}
  120.        
  121.   The example would return the filesize of file number 1 in your bolt
  122.   file!.
  123.  ------------------------------------------------------
  124.   Incname: Bolt/getlink_addr.bb |variable/variable
  125.   Type   : function.L
  126.  
  127.   This is used when you want to save out an linked file to ramdisk or
  128.   floppy disk. Simply pass on the adresse of your bolt structure, as well
  129.   as the number of the linked-file (scan the names list for more info).
  130.   You will then be given the correct adresse of your file, then simply
  131.   use the "getlink_size{}" to know the length of the file.
  132.  
  133.   Ex:  adr.l=allocmem{filesize,2}
  134.        bload "filename",adr.l
  135.        files_linked.l=getlinks{}
  136.        filesize.l=getlink_size{1,adr.l}
  137.        filename$ =getlink_name{1,adr.l}
  138.        base.l=getlink_addr{1,adr.l}
  139.        bsave "ram:"+filename$,base.l,filesize.l
  140.  
  141.   This example would save out file number 1 to ramdisk, under its original
  142.   filename.
  143.  -------------------------------------------------------
  144.  
  145.  
  146.  
  147.